<?php
namespace Home\Controller;
use Home\Controller\BaseController;
class LoginController extends BaseController {
	public function _initialize(){
		//parent::_initialize();
	}
	public function dologin(){
		$map=array(
			"yjl_username"=>I('post.username'),
			"yjl_pass"=>md5(I('post.pass'))
		);
		//var_dump($map);
		$user=M("users")->where($map)->find();
		//var_dump($user);	exit;
		//var_dump($admin);
		if($user){
			session('user',$user);
			
			$this->redirect("Index/index");
		}else{
			$this->redirect('Index/index');
		}
	}
	public function logout(){
		//var_dump($_SESSION['user']);exit;
		session('user',null);
		$this->redirect('Index/index');
	}
}
?>